package com.ruoyi.system.WebController;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.ByDb15;
import com.ruoyi.system.service.IByDb15Service;
import com.ruoyi.system.service.IEsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * StandardController
 *
 * @author ruoyi
 * @date 2024-02-01
 */
@RestController
@RequestMapping("/byWeb/db15")
public class WebByDb15Controller   extends BaseController {

    @Autowired
    private IByDb15Service byDb15Service;

    @Autowired
    private IEsService esService;


    /**
     * 查询Standard列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ByDb15 byDb15)
    {
        startPage();
        List<ByDb15> list = byDb15Service.selectByDb15List(byDb15);
        return getDataTable(list);
    }

    /**
     * 导出Standard列表
     */
    @Log(title = "Standard", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ByDb15 byDb15)
    {
        List<ByDb15> list = byDb15Service.selectByDb15List(byDb15);
        ExcelUtil<ByDb15> util = new ExcelUtil<ByDb15>(ByDb15.class);
        util.exportExcel(response, list, "Standard数据");
    }

    /**
     * 获取Standard详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(byDb15Service.selectByDb15ById(id));
    }


    /**
     * 获取Standard详细信息
     */
    @GetMapping(value = "/getDetail/{id}")
    public AjaxResult getDetail(@PathVariable("id") String id)
    {
        return success(esService.getDetail(id));
    }

    /**
     * 获取Standard详细信息
     */
    @PostMapping(value = "/edit")
    public AjaxResult edit(@RequestBody ByDb15 byDb15)
    {
        return success(esService.edit(byDb15));
    }

    /**
     * 获取Standard详细信息
     */
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody ByDb15 byDb15)
    {
        return success(esService.addContent(byDb15));
    }



    /**
     * 查询Standard列表
     */
    @PostMapping("/getMutilSearch")
    public TableDataInfo getMutilSearch(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.mutilSearch(byDb15,pageNum,pageSize);
    }

    /**
     * 查询Standard列表
     */
    @PostMapping("/getMutilSearchFront")
    public TableDataInfo getMutilSearchFront(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.mutilSearchFront(byDb15,pageNum,pageSize);
    }

    /**
     * 查询Standard列表
     */
    @PostMapping("/searchAll")
    public TableDataInfo searchAll(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.searchAll(byDb15,pageNum,pageSize);
    }

    /**
     * 查询Standard列表
     */
    @PostMapping("/searchAllB")
    public TableDataInfo searchAllB(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.searchAllB(byDb15,pageNum,pageSize);
    }


    /**
     * 查询Standard列表
     */
    @PostMapping("/getDbSearch")
    public TableDataInfo getDbSearch(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.dbSearch(byDb15,pageNum,pageSize);
    }

    /**
     * 查询Standard列表
     */
    @PostMapping("/getGbSearch")
    public TableDataInfo getGbSearch(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.gbSearch(byDb15,pageNum,pageSize);
    }

    /**
     * 查询Standard列表
     */
    @PostMapping("/getMbSearch")
    public TableDataInfo getMbSearch(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.mbSearch(byDb15,pageNum,pageSize);
    }


    /**
     * 查询Standard列表
     */
    @PostMapping("/getHbSearch")
    public TableDataInfo getHbSearch(@RequestBody ByDb15 byDb15)
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        return  esService.hbSearch(byDb15,pageNum,pageSize);
    }


}
